<template>
  <div>
    <section class="main">
      <input
        id="toggle-all"
        class="toggle-all"
        type="checkbox"
        :checked="isAllDone"
        @change="$emit('changeAllDom', $event.target.checked)"
      />
      <label for="toggle-all">全部标记为已完成</label>
      <ul class="todo-list">
        <!-- These are here just to show the structure of the list items -->
        <!-- List items should get the class `editing` when editing and `completed` when marked as completed -->
        <li
          v-for="item in list"
          :key="item.id"
          :class="{ completed: item.isDone }"
        >
          <div class="view">
            <input
              class="toggle"
              type="checkbox"
              :checked="item.isDone"
              @change="update(item.id)"
            />
            <label>{{ item.name }}</label>
            <button class="destroy" @click="$emit('del', item.id)"></button>
          </div>
          <input class="edit" value="Create a TodoMVC template" />
        </li>
        <!-- <li class="completed">
          <div class="view">
            <input class="toggle" type="checkbox" checked />
            <label>早上吃豆浆油条</label>
            <button class="destroy"></button>
          </div>
          <input class="edit" value="Create a TodoMVC template" />
        </li>
        <li>
          <div class="view">
            <input class="toggle" type="checkbox" />
            <label>中午吃大饼卷大葱</label>
            <button class="destroy"></button>
          </div>
          <input class="edit" value="Rule the web" />
        </li> -->
      </ul>
    </section>
  </div>
</template>

<script>
export default {
  name: "",
  components: {},
  //   props: ["list"],
  props: {
    list: Array,
    isAllDone: Boolean,
  },
  data() {
    return {};
  },
  watch: {},
  computed: {},
  methods: {
    update(val) {
      this.$emit("update", val);
    },
  },
  created() {
    console.log(this.list);
  },
  mounted() {},
};
</script>
<style scoped lang="less"></style>
